/**
 * 智能体应用接口
 */
const robotSmarterApi = {
    /**
     * 智能体列表
     *
     * @param {Object} params
     * @param {number} [params.page_no] 当前页码
     * @param {number} [params.page_size] 每页条数
     * @param {string} [params.keyword] 搜索关键词
     * @returns {Promise<RobotSmarterListResponse[]>}
     * @author zero
     */
    lists(params: {
        page_no?: number;
        page_size?: number;
        keyword?: string;
    }): Promise<RobotSmarterListResponse[]> {
        return $request.get<RobotSmarterListResponse[]>({
            url: '/agent/robot/smarter/lists',
            params
        })
    },

    /**
     * 智能体详情
     *
     * @param {string} code 智能体编号
     * @returns {Promise<RobotSmarterDetailResponse>}
     * @author zero
     */
    detail(code: string): Promise<RobotSmarterDetailResponse> {
        return $request.get<RobotSmarterDetailResponse>({
            url: '/agent/robot/smarter/detail',
            params: {
                code
            }
        })
    },

    /**
     * 智能体创建
     *
     * @param {Object} params
     * @param {string} params.name 智能体名称
     * @param {string} [params.intro] 智能体简介
     * @returns {Promise<any>}
     * @author zero
     */
    add(params: {
        name: string;
        intro?: string;
    }): Promise<any> {
        return $request.post({
            url: '/agent/robot/smarter/add',
            params
        })
    },

    /**
     * 智能体编辑
     *
     * @param params
     * @returns {Promise<any>}
     * @author zero
     */
    edit(params: {
        code: string;
        logo: string;
        name: string,
        intro: string;
        search_mode?: string;
        search_tokens?: number;
        search_similar?: number;
        ranking_status?: number;
        optimize_ask?: number;
        annex_similar?: number;
        ranking_score?: number;
        ranking_model?: string;
        optimize_model?: string;
        prompt_roles: string;
        prompt_limit: string;
        welcome_text: string;
        question_guide: boolean | number;
        empty_search_text: string;
        empty_search_type: string;
        max_upload_num: number;
        is_upload_files: boolean | number;
        is_upload_image: boolean | number;
        is_show_timed: boolean | number;
        is_show_quote: boolean | number;
        is_show_context: boolean | number;
        is_original_reply: boolean | number;
        llm_models: string;
        llm_config: Record<string, any>;
        broadcast?: RobotSmarterBroadcast;
        knows?: RobotSmarterKnows[];
        mcps?: RobotSmarterMcps[];
    }): Promise<any> {
        return $request.post({
            url: '/agent/robot/smarter/edit',
            params
        })
    },

    /**
     * 智能体删除
     *
     * @param {string} code
     * @returns {Promise<any>}
     * @author zero
     */
    delete(code: string): Promise<any> {
        return $request.post({
            url: '/agent/robot/smarter/delete',
            params: {
                code
            }
        })
    },

    /**
     * 智能体克隆
     *
     * @param {string} code
     * @returns {Promise<any>}
     * @author zero
     */
    clone(code: string): Promise<any> {
        return $request.post({
            url: '/agent/robot/smarter/clone',
            params: {
                code
            }
        })
    },

    /**
     * 智能体公开
     *
     * @param {string} code
     * @returns {Promise<any>}
     * @author zero
     */
    square(code: string): Promise<any> {
        return $request.post({
            url: '/agent/robot/smarter/square',
            params: {
                code
            }
        })
    },

    /**
     * 智能体收藏
     *
     * @param {string} code
     * @returns {Promise<any>}
     * @author zero
     */
    collect(code: string): Promise<any> {
        return $request.post({
            url: '/agent/robot/smarter/collect',
            params: {
                code
            }
        })
    }
}

export default robotSmarterApi
